Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal error registry per package #636

Merged
merged 5 commits into from
Nov 27, 2024

Conversation

bmoylan
Copy link
Contributor

@bmoylan bmoylan commented Nov 26, 2024

Replace global conjure-type error registration with a generated registry per conjure definition.

Creates a new internal/conjureerrors package in each output directory for conjure definitions that include errors. Generated client implementations provide the definition-specific registry as a ConjureErrorDecoder to be used when deserializing a non-2xx JSON response.

Clients will no longer be able to deserialize errors not defined in their own conjure definition.

Generating multiple IRs into the same output directory will result in all definitions sharing the same error registry.

Requires palantir/conjure-go-runtime#724

Addresses #415


This change is Reviewable

@changelog-app
Copy link

changelog-app bot commented Nov 26, 2024

Generate changelog in changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Replace global conjure-type error registration with a generated registry per conjure definition.

Creates a new internal/conjureerrors package in each output directory for conjure definitions that include errors. Generated client implementations provide the definition-specific registry as a ConjureErrorDecoder to be used when deserializing a non-2xx JSON response.

Clients will no longer be able to deserialize errors not defined in their own conjure definition.

Generating multiple IRs into the same output directory will result in all definitions sharing the same error registry.

Check the box to generate changelog(s)

  • Generate changelog entry

go.mod Outdated
github.com/julienschmidt/httprouter v1.3.0
github.com/nmiyake/pkg/dirs v1.1.0
github.com/palantir/conjure-go-runtime/v2 v2.86.0
github.com/palantir/conjure-go-runtime/v2 v2.86.1-0.20241126014203-f52ba8f67d54
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not merge; requires palantir/conjure-go-runtime#724

@bmoylan bmoylan changed the title demo: Internal error registry per package Internal error registry per package Nov 27, 2024
@bmoylan bmoylan marked this pull request as ready for review November 27, 2024 17:53
Copy link
Contributor

@tabboud tabboud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple notes but otherwise this looks good to me:

  • Not being able to deserialize errors not defined by a Clients conjure definition seems more than reasonable, and in fact maybe more correct.
  • It is common for projects to generate all conjure into a shared output directory, but this would be a good reason to push projects into namespacing their conjure dependencies, which I have found to be a better UX anyways. Besides this behavior would be the same as what currently exists and would not require a migration for users to pick this up.

@bulldozer-bot bulldozer-bot bot merged commit c1639d1 into develop Nov 27, 2024
8 checks passed
@bulldozer-bot bulldozer-bot bot deleted the bm/internal-error-registry branch November 27, 2024 21:32
@autorelease3
Copy link

autorelease3 bot commented Nov 27, 2024

Released v6.63.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants